;  This file is part of tornado.
; 
;    tornado is free software: you can redistribute it And/Or modify
;    it under the terms of the GNU General Public License As published by
;    the Free Software Foundation, either version 3 of the License, Or
;    any later version.
; 
;    tornado is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY Or FITNESS For A PARTICULAR PURPOSE.  See the
;    GNU General Public License For more details.
; 
;    You should have received a copy of the GNU General Public License
;    along With tornado.  If Not, see <http://www.gnu.org/licenses/>. 2
; 

; /////////////////////////////////////////////////////////////////////////////
;
; /////////////////////////////////////////////////////////////////////////////
Procedure clientConnect(*c.sTornadoClient)
  
  If *c\mStateTimer < ElapsedMilliseconds() And *c\mState = #CLIENT_STATUS_NONE
    
    *c\mStateTimer + ElapsedMilliseconds() + 75
    
    *packet = createPacket(#PACKET_SYSTEM)
    value.a = #CLIENT_TRY_TO_CONNECT
  
    pushPacket(*packet, @value        , #TYPE_ASCII)
    pushPacket(*packet, @*c\mPseudo   , #TYPE_STRING)
    pushPacket(*packet, @*c\mPassword , #TYPE_STRING)
    
    clientAddPacket(*packet,*c)
    
  EndIf 
    
EndProcedure

; /////////////////////////////////////////////////////////////////////////////
;
; /////////////////////////////////////////////////////////////////////////////
Procedure serverSendBadPassword(*s.sTornadoServer)

  *packet = createPacket(#PACKET_SYSTEM)
  value.a = #SERVER_SEND_BAD_PASSWORD
  pushPacket(*packet, @value,#TYPE_ASCII)
  serverAddPacket(*packet,*s)
   
EndProcedure
